Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 6 - Printing Resources / Printing Resources Reference
Resources Used for Printing Extensions and Printer Drivers


The Override ('over') Resource

You must provide at least one override resource, of type gxOverrideType, for any printing extension or printer driver that you develop. This resource provides QuickDraw GX with a list of the messages that you are overriding in your extension or driver, along with the ID of the resource in which to find the code for your override's implementation. Figure 6-1 shows the structure of an override resource.

Figure 6-1 The override resource

The override resource consists of a variable number of records, each of which specifies a message, a resource type, a resource ID, and an offset value. Each entry tells QuickDraw GX the name of a printing message that you are overriding and where to find the code for your override.

You need to provide separate override resources for different kinds of printing messages. There are three kinds of messages:

The ID of each override resource indicates which kind of messages are specified in the resource. Different values are used in override resources for printing extensions than are used for printer drivers, as shown in Table 6-1.
Table 6-1 Override resource IDs
Message
type
Extension resource IDDriver resource ID
UniversalgxExtensionUniversalOverrideIDgxDriverUniversalOverrideID
Imaging system0gxDriverImagingOverrideID
MacintoshPrinting ManagerNot allowedgxDriverCompatibilityOverrideID

Imaging system messages are actually separated into categories: messages for the raster imaging system, PostScript imaging system, and vector imaging system. The identifier used for each message type is shown in Table 6-2.
Table 6-2 Printing message constants
Message typeConstantValue
UniversalgxInitialize
gxShutDown
0
1
 gxJobIdle
gxJobStatus
gxPrintingEvent
2
3
4
 gxJobFormatDialog
gxFormatDialog
gxJobPrintDialog
gxFilterPanelEvent
gxHandlePanelEvent
gxParsePageRange
5
6
7
8
9
10
 gxDefaultJob
gxDefaultFormat
gxDefaultPaperType
gxDefaultPrinter
11
12
13
14
 gxCreateSpoolFile
gxSpoolPage
gxSpoolData
gxSpoolResource
gxCompleteSpoolFile
15
16
17
18
19
 gxCountPages
gxDespoolPage
gxDespoolData
gxDespoolResource
gxCloseSpoolFile
20
21
22
23
24
 gxStartJob
gxFinishJob
gxStartPage
gxFinishPage
gxPrintPage
25
26
27
28
29
 gxSetupImageData
gxImageJob
gxImageDocument
gxImagePage
gxRenderPage
gxCreateImageFile
30
31
32
33
34
35
 gxOpenConnection
gxCloseConnection
gxStartSendPage
gxFinishSendPage
36
37
38
39
 gxWriteData
gxBufferData
gxDumpBuffer
gxFreeBuffer
40
41
42
43
 
 gxCheckStatus
gxGetDeviceStatus
gxFetchTaggedData
44
45
46
 gxGetDTPMenuList
gxDTPMenuSelect
gxHandleAlertFilter
47
48
49
 gxJobFormatModeQuery50
 gxWriteStatusToDTPWindow
gxInitializeStatusAlert
gxHandleAlertStatus
gxHandleAlertEvent
51
52
53
54
 gxCleanupStartJob
gxCleanupStartPage
gxCleanupOpenConnection
gxCleanupStartSendPage
55
56
57
58
 gxDefaultDesktopPrinter
gxCaptureOutputDevice
59
60
 gxOpenConnectionRetry
gxExamineSpoolFile
61
62
 gxFinishSendPlane
gxDoesPaperFit
gxChooserMessage
63
64
65
 gxFindPrinterProfile
gxFindFormatProfile
gxSetPrinterProfile
gxSetFormatProfile
66
67
68
69
Macintosh Printing ManagergxPrOpenDoc
gxPrCloseDoc
gxPrOpenPage
gxPrClosePage
gxPrintDefault
gxPrStlDialog
gxPrJobDialog
gxPrStlInit
gxPrJobInit
gxPrDlgMain
gxPrValidate
gxPrJobMerge
gxPrGeneral
gxConvertPrintRecordTo
gxConvertPrintRecordFrom
gxPrintRecordToJob
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Raster imaging systemgxRasterDataIn
gxRasterLineFeed
gxRasterPackageBitmap
0
1
2
PostScript imaging systemgxPostscriptQueryPrinter
gxPostscriptInitializePrinter
gxPostscriptResetPrinter
gxPostscriptExitServer
gxPostscriptGetStatusText
gxPostscriptGetPrinterText
gxPostscriptScanStatusText
gxPostscriptScanPrinterText
gxPostscriptGetDocumentProcSetList
gxPostscriptDownloadProcSetList
gxPostscriptGetPrinterGlyphsInformation
gxPostscriptStreamFont
gxPostscriptDoDocumentHeader
gxPostscriptDoDocumentSetUp
gxPostscriptDoDocumentTrailer
gxPostscriptDoPageSetUp
gxPostscriptSelectPaperType
gxPostscriptDoPageTrailer
gxPostscriptEjectPage
gxPostscriptProcessShape
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Vector imaging systemgxVectorPackageShape
gxVectorLoadPens
gxVectorVectorizeShape
0
1
2

Listing 6-1 shows a typical override resource definition. You can also find examples of override resource definitions in Listing 2-24 on page 2-38 in the chapter "Printing Extensions" and in Listing 3-20 on page 3-56 in the chapter "Printer Drivers."

Listing 6-1 An example of an override resource

#define mySegment 0
#define firstOffset 4

resource gxOverrideType (gxExtensionUniversalOverrideID, sysHeap,
                                                      purgeable)
{
   {
   /* message to override     segmentID    jump table offset */

      gxInitialize,           mySegment,     firstOffset+0,
      gxShutDown,             mySegment,     firstOffset+4,
      gxJobPrintDialog,       mySegment,     firstOffset+8,
      gxHandlePanelEvent,     mySegment,     firstOffset+12,
      gxDespoolPage,          mySegment,     firstOffset+16
   };
};
This resource specifies the universal messages that an extension is overriding. In this case, five messages are being overridden. Each of these messages is found in a code segment with a resource ID of mySegment. The jump ('JMP') statement for the gxInitialize message is found at the first offset (4 bytes) from the start of the jump table, and the jump statements for the subsequent messages are each located 4 bytes apart.

IMPORTANT
Each jump table entry is 4 bytes long, and QuickDraw GX reserves the first 4 bytes in the table for its own use. This means that your first jump table entry must be located at an offset of 4 bytes from the beginning of the table. For this reason, the firstOffset constant in Listing 6-1 is defined with a value of 4.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help